package com.yuhang.demo;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

import com.alibaba.fastjson.JSON;
import com.yuhang.InverntoryPo;
import com.yuhang.demo.util.PostUtil;

public class VmSywTest {

//	static String api = "http://localhost:36062";
//	http://apivmi.go2b2b.com:36063/
int a;
	static String api = "http://apivmi.go2b2b.com:36062";
//	static String api = "xxxhttps://vmi.gsb68.com";
//	Vu1DTuHmI19wW1tNUhHNJ6Qs+oTjFX3wFqd5himRMueBQ+XbwcLITnjwzMBDMFme
	static String token="O9ErDHDjI0I0tVTV/tXsTrydEwuWVqc22x7ImG+n8O/RtCz/F7BLGqyXoVXFrdil";
//	static String token="wytBlqBBtf786bDC93H+8k1+SBPdPNT7Cf/IRiA1FPU4874dsi8ced7y3La6Hbgk";
//DyMCsZXuuraCa4r8U6Wm1SKdKiNygM7OmV6QhnjRqGvd9hgnr+N2baNDZZO/oz4x
	public static void main(String[] args) throws Exception {
//		String result = login();
//		String result = loginweb();
//		String result =sywProductinfo();
//		String result = sywgetProductInfoByArtNo();
//		String result = sywproductList();
//		String result = detail();
//		String result = productgetSn();
//		String result =setCostPrice();
//		String result =getProductInfoBySn();
//		String result =addWorkStoreProduct();
//		String result =storeList();
//		String result =storeDetailList();
//		String result =queryStock();
		//String result =saleOut();
//		String result =refundIn();
//		String result = revokeStoreProduct();
//		String result =changeStockNum();
//		String result =salecustominfo();
//		String result = debtInfo();
//		String result =	saleList();
		String result=queryQuickStock();
		System.out.println(result);
	}
	
	
	public static String commongetBarcodeLog() throws Exception {
		String url = api + "/api/syw/common/getBarcodeLog";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("sn", "100000002"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String productgetSn() throws Exception {
		String url = api + "/api/syw/product/getSn";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("json", "[{\"color\":\"粉红色\",\"productId\":1382204,\"quantity\":1,\"size\":\"100\"}]"));
		formparams.add(new BasicNameValuePair("productId", "1382204"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String setCostPrice() throws Exception {
		String url = api + "/api/syw/product/setCostPrice";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("costPrice", "11"));
		formparams.add(new BasicNameValuePair("productId", "1382204"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String sywproductList() throws Exception {
		String url = api + "/api/syw/product/list";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("pageSize", "1"));
		formparams.add(new BasicNameValuePair("pageNo", "19"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String detail() throws Exception {
		String url = api + "/api/syw/product/detail/1382204";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String queryQuickStock() throws Exception {
		String url = api + "/api/syw/sale/queryQuickStock";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("productId", "1215616"));
		formparams.add(new BasicNameValuePair("color", "白色"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String getColorListByArtNo() throws Exception {
		String url = api + "/api/syw/sale/getColorListByArtNo";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("artNo", "D230"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String backgetBarcodeLog() throws Exception {
		String url = api + "/backstage/getBarcodeLog";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("barcodeId", "100000002");
//		params.put("status", "创意");
		return PostUtil.httpAppVm(url, params);
	}
	public static String backgetCategoryList() throws Exception {
		String url = api + "/backstage/getCategoryList";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("sn", "1");
		params.put("supplierName", "创意");
//		params.put("status", "创意");
		return PostUtil.httpAppVm(url, params);
	}
	
	public static String backgetFlowRecordList() throws Exception {
		String url = api + "/backstage/getFlowRecordList";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("sn", "1");
		params.put("supplierName", "1");
		params.put("pageSize", "1");
		params.put("status", "PRODUCE");
		return PostUtil.httpAppVm(url, params);
	}
	
	
	public static String backgetStockList() throws Exception {
		String url = api + "/backstage/getStockList";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("sn", "1");
		params.put("supplierName", "1");
//		params.put("status", "创意");
		return PostUtil.httpAppVm(url, params);
	}
	
	public static String backgetProductSnList() throws Exception {
		String url = api + "/backstage/getProductSnList";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("sn", "1");
		params.put("supplierName", "创意");
//		params.put("status", "创意");
		return PostUtil.httpAppVm(url, params);
	}
	
	public static String queryStock() throws Exception {
		String url = api + "/api/syw/store/queryStock";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("warehouseId", "6"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String storeDetailList() throws Exception {
		String url = api + "/api/syw/store/storeDetailList";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("storeId", "392"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String storeList() throws Exception {
		String url = api + "/api/syw/store/storeList";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("payType", "ALI"));
		formparams.add(new BasicNameValuePair("endTime", "2020-04-30"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String sywgetProductInfoByArtNo() throws Exception {
		String url = api + "/api/syw/product/getProductInfoByArtNo";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("artNo", "1"));
		formparams.add(new BasicNameValuePair("limitNum", "1"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String sywProductList() throws Exception {
		String url = api + "/api/syw/product/list";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("artNo", "1"));
		formparams.add(new BasicNameValuePair("limitNum", "1"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String test() throws Exception {
		String url = api + "/api/syw/store/test";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String getProductInfoBySn() throws Exception {
		String url = api + "/api/syw/store/getProductInfoBySn";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("sn", "100000002"));
		formparams.add(new BasicNameValuePair("warehouseId", "6"));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String sywProductinfo() throws Exception {
		String url = api + "/api/syw/product/info";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String addWorkStoreProduct() throws Exception {
		String url = api + "/api/syw/store/addWorkStoreProduct";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("token", token));
		formparams.add(new BasicNameValuePair("warehouseId", "32"));
		List<StoreInVo> list = new ArrayList<StoreInVo>();
		StoreInVo vo = new StoreInVo();
		vo.setQuantity(20);
		vo.setSn("100000013");
		list.add(vo);
		formparams.add(new BasicNameValuePair("json", JSON.toJSONString(list)));
		formparams.add(new BasicNameValuePair("payType", "DEBT"));//DEBT ALI
		formparams.add(new BasicNameValuePair("remark", token));
		return PostUtil.httpPost(url, formparams);
	}
	
 
	public static String getAllWarehouse() throws Exception {
		String url = api + "/api/syw/store/getAllWarehouse";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("username", "创意·雨燕"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	
	public static String loginweb() throws Exception {
		String url = api + "/loginweb";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("username", "创意·雨燕"));
		formparams.add(new BasicNameValuePair("password", "aH9j8P2e9t3c"));
		formparams.add(new BasicNameValuePair("source", "go2"));
		return PostUtil.httpPost(url, formparams);
		
	}

	public static String login() throws Exception {
		String url = api + "/login";


		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
//		formparams.add(new BasicNameValuePair("username", "创意·雨燕"));
//		formparams.add(new BasicNameValuePair("password", "T1Hj745M7n2a"));
		formparams.add(new BasicNameValuePair("username", "11a7c9e028c66b1cf09ade0eafb12155"));
		// 160b7fca7dfb76fcd7fef3e25340458f 创意·雨燕
		//11a7c9e028c66b1cf09ade0eafb12155 爱宝贝童装
		formparams.add(new BasicNameValuePair("password", "74d266ab7f4cba76b7b1c90f948b9403"));
		formparams.add(new BasicNameValuePair("source", "4e151895b36d0c471a66f53531896f15"));
		return PostUtil.httpPost(url, formparams);

	}
	public static String addCustomer() throws Exception {
		String url = api + "/api/customer/addCustomer";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("name", "dpc0827"));
		formparams.add(new BasicNameValuePair("goUserId", "59722"));
		formparams.add(new BasicNameValuePair("phone", "1236788"));
		formparams.add(new BasicNameValuePair("userName", "dpc0827"));
		formparams.add(new BasicNameValuePair("remark", "test"));
		
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String queryCustomerByName() throws Exception {
		String url = api + "/api/customer/queryCustomerByName";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("name", "dpc0827"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String queryGo2UserByMobile() throws Exception {
		String url = api + "/api/customer/queryGo2UserByMobile";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("mobile", "1236788"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String revokeStoreProduct() throws Exception {
		String url = api + "/api/syw/store/revokeStoreProduct";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("storeId", "82"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String changeStockNum() throws Exception {
		String url = api + "/api/syw/product/changeStockNum";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("productId", "58491"));
		formparams.add(new BasicNameValuePair("color", "黑色"));
		formparams.add(new BasicNameValuePair("size", "34"));
		formparams.add(new BasicNameValuePair("warehouseId", "2"));
		formparams.add(new BasicNameValuePair("num", "1"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String salecustominfo() throws Exception {
		String url = api + "/api/syw/sale/info";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("customName", "E"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String updateCustomer() throws Exception {
		String url = api + "/api/customer/updateCustomer";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("id", "6"));
		formparams.add(new BasicNameValuePair("userId", "59722"));
		formparams.add(new BasicNameValuePair("phone", "1236788"));
		formparams.add(new BasicNameValuePair("userName", "dpc0827"));
		formparams.add(new BasicNameValuePair("remark", "test"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String customerList() throws Exception {
		String url = api + "/api/customer/customerList";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("name", "d"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String searchCustomerList() throws Exception {
		String url = api + "/api/customer/searchCustomerList";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("name", "d"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String getRefundProductInfoBySn() throws Exception {
		String url = api + "/api/sale/getRefundProductInfoBySn";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("sn", "100000059"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String saleOut() throws Exception {
		String url = api + "/api/syw/sale/saleOut";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("warehouseId", "32"));
		formparams.add(new BasicNameValuePair("customerId", "71"));
		formparams.add(new BasicNameValuePair("json", "[{\"color\":\"粉红色\",\"price\":11.0,\"productId\":1382204,\"quantity\":1,\"size\":\"90\",\"sn\":\"100000013\"}]"));
		formparams.add(new BasicNameValuePair("payType", "DEBT"));
		formparams.add(new BasicNameValuePair("remark", "100000013"));
		formparams.add(new BasicNameValuePair("saleMode", "1"));
		formparams.add(new BasicNameValuePair("saleState", "0"));
		formparams.add(new BasicNameValuePair("discount", "0"));
		formparams.add(new BasicNameValuePair("extraFee", "0"));
		
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	public static String refundIn() throws Exception {
		String url = api + "/api/syw/sale/refundIn";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("warehouseId", "6"));
		formparams.add(new BasicNameValuePair("customerId", "60"));
		formparams.add(new BasicNameValuePair("json", "[{\"color\":\"粉红色\",\"price\":11.0,\"productId\":1382204,\"quantity\":1,\"size\":\"90\",\"sn\":\"100000002\"}]"));
		formparams.add(new BasicNameValuePair("payType", "DEBT"));
		formparams.add(new BasicNameValuePair("remark", "100000059"));
		formparams.add(new BasicNameValuePair("saleMode", "1"));
		formparams.add(new BasicNameValuePair("saleState", "0"));
		formparams.add(new BasicNameValuePair("discount", "0"));
		formparams.add(new BasicNameValuePair("extraFee", "0"));
		
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	
	public static String debtInfo() throws Exception {
		String url = api + "/api/syw/sale/debtInfo";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("customerId", "60"));
		formparams.add(new BasicNameValuePair("type", "1"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String saleList() throws Exception {
		String url = api + "/api/syw/sale/saleList";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("customerId", "60"));
		formparams.add(new BasicNameValuePair("type", "1"));
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	
	public static String getSkuInfoBySn() throws Exception {
		String url = api + "/api/inventory/getSkuInfoBySn";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("warehouseId", "2"));
		formparams.add(new BasicNameValuePair("sn", "100000408,100000409,100000410"));
		
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	public static String updateInventory() throws Exception {
		String url = api + "/api/inventory/updateInventory";
		List<NameValuePair> formparams = new ArrayList<NameValuePair>();
		formparams.add(new BasicNameValuePair("warehouseId", "2"));
		List<InverntoryPo> list = new ArrayList<InverntoryPo>();
		InverntoryPo p = new InverntoryPo();
		p.setArtNo("S129");
		p.setColor("黑色薄绒");
		p.setNewQuantity(1);
		p.setOldQuantity(-1);
		p.setProductId(585432L);
		p.setSize("35");
		List<String> sn = new ArrayList<String>();
		sn.add("100000408");
		p.setSn(sn);
		list.add(p);
		formparams.add(new BasicNameValuePair("json", JSON.toJSONString(list)));
		
		formparams.add(new BasicNameValuePair("token", token));
		return PostUtil.httpPost(url, formparams);
	}
	
	
	
	public static String getDebugTag() throws Exception {
		String url = api + "/backstage/getDebugTag";
		Map<String,Object> params = new HashMap<String,Object>();
		return PostUtil.httpAppVm(url, params);
		
	}
	
	public static String setDebugTag() throws Exception {
		String url = api + "/backstage/setDebugTag";
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("userId", "33");
		return PostUtil.httpAppVm(url, params);
		
	}
}
